Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(nodes): respect nodes denylist #5893

Closed
wants to merge 20 commits into from

Conversation

psychedelicious
Copy link
Collaborator

What type of PR is this? (check all applicable)

  • Refactor
  • Feature
  • Bug Fix
  • Optimization
  • Documentation Update
  • Community Node Submission

Description

In #5838 graph validation was updated to resolve the issue with the nodes union and import order. That broke the nodes denylist functionality.

However, because the corresponding test was marked as xfail, we didn't catch the issue.

  • Fix the nodes denylist handling
  • Update the tests

QA Instructions, Screenshots, Recordings

The test coverage is sufficient.

Merge Plan

This PR can be merged when approved

Added/updated tests?

  • Yes
  • No : please replace this line with details on why tests
    have not been included

In #5838 graph validation was updated to resolve the issue with the nodes union and import order. That broke the nodes denylist functionality.

However, because the corresponding test was marked as `xfail`, we didn't catch the issue.

- Fix the nodes denylist handling
- Update the tests
@github-actions github-actions bot added python PRs that change python files invocations PRs that change invocations python-tests PRs that change python tests labels Mar 8, 2024
@psychedelicious
Copy link
Collaborator Author

I think the test failure is related to how pytest scopes test runs. I'll pick this up later.

@brandonrising brandonrising self-requested a review March 8, 2024 17:45
Lincoln Stein and others added 15 commits April 18, 2024 21:33
We don't need separate implementations for this class, let's not complicate it with an ABC
TypeVar is for generics, but the usage here is as an alias
The only pydantic usage was to convert strings to `Version` objects. The reason to do this conversion was to allow the register decorator to accept strings. MigrationEntry is only created inside this class, so we can just create versions from each migration when instantiating MigrationEntry instead.

Also, pydantic doesn't provide runtime time checking for arbitrary classes like Version, so we don't get any real benefit.
This was checking a `Version` object against a `MigrationEntry`, but what we want is to check the version object against `MigrationEntry.from_version`
@github-actions github-actions bot added the services PRs that change app services label Apr 28, 2024
@lstein
Copy link
Collaborator

lstein commented Apr 28, 2024

I have fixed the "test_deny_nodes()" test so that it doesn't interfere with later tests. The fix involved clearing the config cache after the test finishes running so that the allow_nodes and deny_nodes values are returned to their defaults, and also clearing BaseInvocation._typeadapter so that the cached graph typeadapter is returned to its default state. There is no public API for clearing the typeadapter, so I directly set the protected _typeadapter attribute ito None. I debated whether it would be better to add a clear_cached_typeadapter() to the BaseInvocation API, but this seems like overkill.

Both cache clearing steps are done in a context manager, and should be immune to exceptions, etc.

Copy link
Collaborator

@lstein lstein left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@psychedelicious
Copy link
Collaborator Author

psychedelicious commented Apr 28, 2024

Thanks! It looks like this picked up the config migrator though, need to wait for that to merge before this PR can merge. Or bring the changes in this PR into the config migrator PR.

@lstein
Copy link
Collaborator

lstein commented Apr 30, 2024

Thanks! It looks like this picked up the config migrator though, need to wait for that to merge before this PR can merge. Or bring the changes in this PR into the config migrator PR.

Sorry - wonder how that happened?

@psychedelicious
Copy link
Collaborator Author

Superseded by #7235

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
invocations PRs that change invocations python PRs that change python files python-tests PRs that change python tests services PRs that change app services
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants